package lib;



import java.util.Iterator;

public class IteratorPerso implements Iterator<Element> {

	private ListePerso list;
	private int index;
	
	public IteratorPerso(ListePerso list) {
		this.setList(list);
		this.index=0;
	}
	
	
	@Override
	public boolean hasNext() {
		if(this.list.getProchainElement().getElementSuivant()!=null)
		{
			return true;
		}
		else
		{
			return false;
		}
	}

	@Override
	public Element next() {
		Element tmp;
		tmp=this.list.getProchainElement();
		this.list.setProchainElement(tmp.getElementSuivant());
		return tmp;
	}

	@Override
	public void remove() {
		
	}


	public ListePerso getList() {
		return list;
	}


	public void setList(ListePerso list) {
		this.list = list;
	}


	public int getIndex() {
		return index;
	}


	public void setIndex(int index) {
		this.index = index;
	}

}
